function getxhr(){
	var xhr = false;
	if(window . XMLHttpRequest){
		xhr = new XMLHttpRequest();
	}else{
		xhr = window . ActiveXObject('Microsoft . XMLHttp');
	}
	return xhr;
}

function search2(url){
	
	var cat_id = document.getElementsByName('cat_id')[0] . value;
	var is_on_sale = document.getElementsByName('is_on_sale')[0] . value;
	var keyword = document.getElementsByName('keyword')[0] . value;
	var recommend = document.getElementsByName('recommend')[0].value;
	
	if(cat_id !=0 || is_on_sale != 2 || keyword !='' || recommend != 0){
		
		var xhr = getxhr();
		var url = url + '&cat_id=' + cat_id + '&is_on_sale=' + is_on_sale + '&keyword=' + keyword + '&recommend=' + recommend;

		xhr.open('GET', url, true);
		
		xhr.onreadystatechange=function (){
			if(xhr.readyState==4){
				
				if(xhr.responseText==1){
					alert('ok');
				}else{
					alert('error');
				}
			}
		}
		xhr.send(null);
	}
	
	
}

